//      链表
public class Test {
    public static void main1(String[] args) {
        MyLinkedList myLinkedList = new MyLinkedList();//先有对象 才可以调用类方法
        myLinkedList.createList();

        myLinkedList.display();//打印
        System.out.println(myLinkedList.contains(78));//看是否存在那个元素
        System.out.println(myLinkedList.size());//打印长度
//        头插法
        System.out.println("=======头插法=======");
        myLinkedList.addFirst(89);
        myLinkedList.display();
//        尾插法
        System.out.println("=========尾插法========");
        myLinkedList.addLast(99);
        myLinkedList.display();
        System.out.println("========任意位置插入========");
        myLinkedList.addIndex(0,1);
        myLinkedList.display();
        myLinkedList.addIndex(8,1);
        myLinkedList.display();
        myLinkedList.addIndex(4,1);
        myLinkedList.display();
    }

    public static void main2(String[] args) {
        MyLinkedList myLinkedList = new MyLinkedList();
        myLinkedList.createList();
        myLinkedList.display();
        System.out.println("========删除12=======");
        myLinkedList.remove(12);
        myLinkedList.display();
        System.out.println("========删除56=======");
        myLinkedList.remove(56);
        myLinkedList.display();
        System.out.println("========删除34=======");
        myLinkedList.remove(34);
        myLinkedList.display();
    }

    public static void main(String[] args) {
        MyLinkedList myLinkedList = new MyLinkedList();
        myLinkedList.createList();
        myLinkedList.display();
        myLinkedList.addLast(34);
        myLinkedList.addLast(34);
        myLinkedList.addLast(56);
        myLinkedList.addLast(34);
        myLinkedList.addFirst(34);
        myLinkedList.addIndex(3,34);
        myLinkedList.display();
        myLinkedList.removeAllKey(34);
        myLinkedList.display();


    }
}
